package com.chuangjiangx.member.basic.ddd.query.condition;

import com.chuangjiangx.commons.QueryCondition;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;

import java.util.Date;

@Getter
@Setter
public class MemberCondition extends QueryCondition {

    /**
     * 手机号码、姓名
     */
    private String nameOrMobile;

    /**
     * 性别
     */
    private Byte sex;

    /**
     * 注册门店
     */
    private Long registerStoreId;

    /**
     * 开始时间
     */
    private Date startRegisterTime;

    /**
     * 结束时间
     */
    private Date endRegisterTime;

    /**
     * 门店名称
     */
    private String storeName;

    /**
     * 所属商户id
     */
    private Long merchantId;

    public void setNameOrMobile(String nameOrMobile) {
        if (StringUtils.isNotBlank(nameOrMobile)) {
            this.nameOrMobile = "%" + nameOrMobile + "%";
        }
    }

    public void setStoreName(String storeName) {
        if (StringUtils.isNotBlank(storeName)) {
            this.storeName = "%" + storeName + "%";
        }
    }
}
